import { Button, Input } from 'antd'
import imgLogo from './logo.png'
import './login.styl'
import { useNavigate } from 'react-router-dom'
import { useEffect } from 'react'

function Login() {
    // 创建路由钩子
    const navigate = useNavigate()
    // useEffect(()=>{
    //     navigate('/home')
    // },[])
    const open_newwin = ()=>{
        const { ipcRenderer } = window.electron;
        ipcRenderer.send('open_new_win')
    }
    const open_newwin_ffmpeg = ()=>{
        const { ipcRenderer } = window.electron;
        ipcRenderer.send('open_new_win_ffmpeg')
    }
    return (
        <div className="P-login">
            <img src={imgLogo} alt="" className="logo" />
            <div className="ipt-con">
                <Input placeholder="账号" />
            </div>
            <div className="ipt-con">
                <Input.Password placeholder="密码" />
            </div>
            <div className="ipt-con">
                <Button type="primary" onClick={()=>{navigate('/home')}}>
                    登录
                </Button>
            </div>
            <Button onClick={open_newwin}>打开新窗口</Button>
            <Button onClick={open_newwin_ffmpeg}>打开ffmpeg测试窗口</Button>
        </div>
    )
}

export default Login